/**
 * @file drv_gpio.h
 * @brief HAL CUBEMX DRIVER
 * 
 * @author dalin (dalin@open-robot.com)
 * @version 1.0
 * @date 2023-05-10
 * 
 * @copyright Copyright (c) 2023  Open Robot Tech.co, Ltd
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2023-05-10 <td>1.0     <td>dalin     <td>内容
 * </table>
 */

#ifndef _DRV_GPIO_H_
#define _DRV_GPIO_H_
#include "drv_config.h"

#ifdef USE_GPIO_DRIVER
#include "gpio.h"

typedef enum
{
  DRV_PIN_LOW = 0u,
  DRV_PIN_HIGH
} drvPinState_e;

typedef enum DRV_GPIO_TYPE
{
    DRV_GPIO_INIT = 0,
    DRV_GPIOA,
    DRV_GPIOB,
	DRV_GPIOC,
    DRV_GPIOD,
    DRV_GPIOE,
    DRV_GPIOF,
    DRV_GPIOG,

    DRV_GPIO_MAX
}gpioType_e;


typedef enum 
{
    DRV_PIN_0 = 0x0,
    DRV_PIN_1,
    DRV_PIN_2,
    DRV_PIN_3,
    DRV_PIN_4,
    DRV_PIN_5,
    DRV_PIN_6,
	DRV_PIN_7,
    DRV_PIN_8,
    DRV_PIN_9,
    DRV_PIN_10,
    DRV_PIN_11,
    DRV_PIN_12,
    DRV_PIN_13,
    DRV_PIN_14,
    DRV_PIN_15,
    DRV_PIN_ALL,

    DRV_PIN_MAX
}gpioPin_e;


typedef struct DRV_GPIO_
{
    gpioType_e      gpiox;
    gpioPin_e       pin;
    drvPinState_e   ste;
}gpioDrv_t;


/**
 * @brief 设置IO状态
 * 
 * @param  drv              : GPIO设备
 * 
 */
void drv_gpio_write(gpioDrv_t drv, drvPinState_e ste);


/**
 * @brief 读取IO状态
 * 
 * @param  gpiox            : GPIO端口
 * @param  pinx             : PIN号(0..15)
 * 
 * @return drvPinState_e 
 */
drvPinState_e drv_gpio_read(gpioDrv_t drv);


/**
 * @brief 
 * 
 * @param  gpiox            : GPIO端口
 * @param  pinx             : PIN号(0..15)
 * 
 */
void drv_gpio_toggle(gpioDrv_t drv);


#endif /* USE_GPIO_DRIVER */
#endif  /* _DRV_GPIO_H_ */
